home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
351-375
/
359
/
dice
/
dice.lzh
/
lib
/
amiga
/
path.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-27
|
932b
|
52 lines
/*
* PATH.C
*
* (c)Copyright 1990, Matthew Dillon, All Rights Reserved
*
* Search the path for a command name
*/
#include <exec/types.h>
#include <exec/execbase.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <stdio.h>
#include <lib/bcpl.h>
typedef struct CommandLineInterface CLI;
typedef struct Process Process;
typedef struct LockList {
BPTR NextPath;
BPTR PathLock;
} LockList;
extern struct ExecBase *SysBase;
BPTR
_SearchPath(cmd)
char *cmd;
{
CLI *cli = BTOC(((Process *)SysBase->ThisTask)->pr_CLI, CLI);
LockList *ll = BTOC(cli->cli_CommandDir, LockList);
while (ll) {
if (ll->PathLock) {
long oldLock = CurrentDir(ll->PathLock);
long lock;
if (lock = Lock(cmd, SHARED_LOCK)) {
UnLock(lock);
CurrentDir(oldLock);
return(ll->PathLock);
}
CurrentDir(oldLock);
}
ll = BTOC(ll->NextPath, LockList);
}
return(NULL);
}